﻿using SXFramWork.Core;
using SXFramWork.Model;
using System.Threading.Tasks;

namespace SXFramWork.Repository
{
    public class SysAuthInfoRepository : RepositoryAbstract<SysAuthInfoEntity>, ISysAuthInfoRepository
    {
        public SysAuthInfoRepository(IDbContext dbContext) : base(dbContext)
        {

        }

        public async Task<SysAuthInfoEntity> GetByRefreshToken(string refreshToken)
        {
            return await FromSql.GetDataAsync("select * from SysAuthInfo where [RefreshToken]=@RefreshToken", new { RefreshToken =refreshToken });
        }

        public async Task<SysAuthInfoEntity> GetByUserIdAsync(string userid)
        {
            return await FromSql.GetDataAsync("select * from SysAuthInfo where SysUserId=@UId", new {UId=userid });
        }


    }
}
